@font-face {
  font-family: Bega;
  src: url('~@/assets/fonts/Bega-Light.ttf');
  font-display: swap;
}

body {
  color: var(--color-text);
  background-color: var(--bg);
  transition: background-color .3s;
}

// 头部
$header-height: 45px;

.header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: calc(100% - #{$asideWidth});
  height: 0;
  padding: 0 15px;
  transition: width .3s;

  @media (max-width: 992px) {
    z-index: 998;
    height: $header-height;
    line-height: $header-height;
    background-color: var(--bg-normal);
    box-shadow: 2px 0 10px rgba(0, 0, 0, .1);
  }

  &-logo {
    position: relative;
    float: left;
    line-height: $header-height;

    &__avatar {
      height: 36px;
      margin-right: 3px;
      vertical-align: middle;
      border-radius: 20px;
    }

    &__hamburger {
      padding: 6px;
      font-size: 18px;
      cursor: pointer;

      &:hover {
        color: var(--color-heading);
      }
    }
  }

  &-menus {
    float: right;
    height: $header-height;
    line-height: $header-height;
    text-align: right;

    &__btn {
      padding: 5px;
      margin-left: 3px;
      font-size: 18px;
      color: var(--color-text);
      cursor: pointer;
      user-select: none;
      outline: none;

      &:hover {
        color: var(--color-heading);
      }
    }
  }
}

// 侧边菜单
.aside {
  position: fixed;
  top: 16px;
  bottom: 16px;
  z-index: 999;
  width: $asideWidth;
  overflow: hidden;
  background-color: var(--bg-normal);
  border-radius: $border-radius;
  box-shadow: $shadow-3-right;
  transition: width .3s;

  &-logo {
    padding: 48px 0 16px;
    text-align: center;
    background-color: var(--bg-normal);

    &__img {
      width: 104px;
      height: 104px;
      border-radius: 50%;
      transition: all .3s;
    }

    &__name {
      padding: 8px 0;
      overflow: hidden;
      font-family: Bega, sans-serif;
      font-size: 30px;
      color: var(--color-primary);
      white-space: nowrap;
      transition: width .3s;
    }

    &__hitokoto {
      font-size: 15px;
      color: var(--color-secondary);
      white-space: nowrap;
      transition: width .3s;
    }
  }

  &-scrollbar {
    height: calc(100vh - 330px);

    &-wrapper {
      overflow-x: hidden;
    }

    .el-scrollbar__bar.is-horizontal {
      display: none;
    }
  }

  &-menu {
    height: 100%;
    border-right: none !important;

    &__icon {
      width: 24px;
      margin-right: 5px;
      font-size: 18px;
      text-align: center;
      vertical-align: middle;
    }
  }

  &-info {
    position: absolute;
    bottom: 8px;
    box-sizing: border-box;
    width: 100%;
    padding: 0 6px;

    li {
      float: left;
      width: 20%;
      height: 44px;
      line-height: 44px;
      text-align: center;
    }
    $iconWidth: 40px;

    &__icon {
      display: inline-block;
      width: $iconWidth;
      height: $iconWidth;
      font-size: 18px;
      line-height: $iconWidth;
      color: var(--color-text);
      vertical-align: middle;
      background-color: rgba(0, 0, 0, .15);
      transition: all .3s;
      clip-path: polygon(50% 3%, 91% 25%, 91% 75%, 50% 97%, 9% 75%, 9% 25%);

      &:hover {
        color: var(--color-primary);
        background-color: rgba(0, 0, 0, .25);
      }
    }
  }

  &--collapse &-logo {
    padding: 24px 0 0;

    &__img {
      width: 50px;
      height: 50px;
    }

    &__name {
      width: 0;
      height: 0;
      padding: 0;
    }

    &__hitokoto {
      display: none;
    }
  }

  &--collapse &-scrollbar {
    height: calc(100vh - 80px);
  }

  &--collapse &-info {
    display: none;
  }

  .horizontal-collapse-transition {
    transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
  }

  .el-menu {
    background: none;

    .el-submenu {
      .el-menu-item {
        height: 46px;
        margin-bottom: 2px;
        line-height: 46px;
      }

      &.is-active {
        .el-submenu__title {
          &,
          i {
            color: var(--color-primary);
          }
        }
      }
    }

    &--popup {
      background-color: var(--bg-normal);
    }

    .el-menu-item,
    .el-submenu__title {
      height: 48px;
      line-height: 48px;
      color: var(--color-heading);
    }

    .el-menu-item {
      &.is-active {
        color: var(--color-primary);
      }

      &:focus,
      &:hover {
        color: var(--color-primary);
        background: none;

        a,
        i {
          color: var(--color-primary);
        }
      }
    }

    .el-submenu__title:hover {
      color: var(--color-primary);
      background: none;

      i {
        color: var(--color-primary);
      }
    }
  }
}

// 内容
.app {
  &-mask {
    position: fixed;
    top: 0;
    z-index: 999;
    width: 100%;
    height: 100%;
    background-color: rgba($color: #000000, $alpha: .5);
  }
}

.main {
  padding-top: 16px;
  margin-left: $asideWidth + $grid-space;
  transition: margin .3s;

  @media (max-width: 992px) {
    margin-right: 0;
  }

  &-wrapper {
    min-height: calc(100vh - 103px);
  }
}

// 底部
.footer {
  padding: $grid-space 0;
  font-size: 14px;
  line-height: 1.3;
  color: var(--color-heading);

  &__icon {
    padding: 0 3px;
    vertical-align: text-bottom;
  }

  &-info {
    margin-bottom: 5px;
    text-align: center;

    @media (max-width: 576px) {
      display: none;
    }
  }

  &-copyright {
    text-align: center;

    &__link {
      margin-left: 10px;
      color: var(--color-primary);

      @media (max-width: 576px) {
        display: none;
      }
    }
  }
}

.hideAside {
  .aside {
    width: 64px;

    &-wrap {
      overflow: hidden;
    }

    .el-submenu {
      overflow: hidden;

      & > .el-submenu__title {
        .el-submenu__icon-arrow {
          display: none;
        }
      }
    }

    .el-menu--collapse {
      .el-submenu {
        & > .el-submenu__title {
          & > span {
            display: inline-block;
            width: 0;
            height: 0;
            overflow: hidden;
            visibility: hidden;
          }
        }
      }
    }
  }

  .header {
    width: calc(100% - 64px);
  }

  .main {
    margin-left: 88px;
  }
}

.mobile {
  .header {
    width: 100%;
  }

  .main {
    padding-top: $header-height + 15px;
    margin-left: 0;
  }

  .aside {
    top: 0;
    bottom: 0;
    left: 0;
    width: $asideWidth !important;
    border-radius: 0;
    transition: transform .28s;

    &-logo {
      padding-top: 32px;

      &__img {
        transition: none;
      }
    }

    &-scrollbar {
      height: calc(100% - 100px);
    }

    &-info {
      display: none;
    }
  }

  &.hideAside {
    .aside {
      pointer-events: none;
      transition-duration: .3s;
      transform: translate3d(-$asideWidth, 0, 0);
    }
  }

  &.openAside.app {
    position: fixed;
    top: 0;
  }
}

.withoutAnimation {
  .main,
  .aside {
    transition: none;
  }
}
